const Router = require('koa-router')
const {
	menu,
	list,
	artist,
	start,
	isrunning,
} = require('../modules/module-task')

const router = new Router()

// router.use((ctx, next) => {
// 	next()
// })

router.post('/menu', async (ctx, next) => {
	let result = await menu()
	ctx.response.body = result
})

router.post('/list', async (ctx, next) => {
	let params = ctx.request.body
	let result = await list(params)
	ctx.response.body = result
})

router.post('/artist', async (ctx, next) => {
	let params = ctx.request.body
	let result = await artist(params)
	ctx.response.body = result
})

router.post('/start', async (ctx, next) => {
	let params = ctx.request.body
	let result = await start(params)
	ctx.response.body = result
})

router.post('/isrunning', async (ctx, next) => {
	let params = ctx.request.body
	let result = await isrunning(params)
	ctx.response.body = result
})

module.exports = router